package com.zhz.springbootdemo.web;

import com.zhz.springbootdemo.comm.Info;
import com.zhz.springbootdemo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class HelloController {

    @Resource
    private Info info;

    @Autowired
    private DemoService demoService;

    @RequestMapping(value = "/hello")
    @ResponseBody
    public String hello(){
        String msg = demoService.sayHello();
        msg += " "+info.getName()+" "+info.getEmail();
        return msg;
    }
}
